<%@ Page Language="C#" MasterPageFile="~/cms.master" AutoEventWireup="true" CodeFile="PaymentsAndShipment.aspx.cs"
    Inherits="PaymentsAndShipment" Title="<%$Resources:Language,CmsConfigTitle %>"
    ValidateRequest="false" %>

<%@ Register Src="../controls/ctrlShowInfo.ascx" TagName="ctrlShowInfo" TagPrefix="uc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="axc" %>
<%@ Register Src="~/controls/ctrlWait.ascx" TagName="ctrlWait" TagPrefix="ctrl" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphMain" runat="Server">

    <script type="text/javascript" src="../Javascript/jquery.js"></script>

    <script type="text/javascript" language="javascript" src="../Javascript/Config.js"></script>

    <div id="dPaymentsAndShipments">
        <h2>
            <%=Resources.Language.PaymentsAndShipment %></h2>
        <ctrl:ctrlWait ID="ctrlWait" runat="server" />
        <uc1:ctrlShowInfo ID="CtrlShowInfo" runat="server" />
        <axc:TabContainer ID="tcConfig" runat="server" ActiveTabIndex="0">
            <axc:TabPanel ID="tpPayments" runat="server" HeaderText="<%$Resources:Language,PaymentsOptions %>">
                <ContentTemplate>
                    <asp:UpdatePanel ID="upPayments" runat="server">
                        <ContentTemplate>
                            <fieldset class="vSeparate">
                                <legend>
                                    <%= Resources.Language.PaymentType %></legend>
                                <%= Resources.Language.Lang %>:
                                <asp:DropDownList ID="ddlPaymentLanguage" runat="server" DataTextField="Name" DataValueField="LanguageID"
                                    AutoPostBack="True" OnSelectedIndexChanged="ddlPaymentLanguage_SelectedIndexChanged">
                                </asp:DropDownList>
                                <div class="vSeparate">
                                    <asp:Repeater ID="rptPayments" runat="server">
                                        <HeaderTemplate>
                                            <table class="cmsTables">
                                                <tr>
                                                    <th>
                                                        ID
                                                    </th>
                                                    <th>
                                                        <%=Resources.Language.Name%>
                                                    </th>
                                                    <th>
                                                        <%=Resources.Language.Active %>
                                                    </th>
                                                    <th>
                                                        <%=Resources.Language.Kind %>
                                                    </th>
                                                    <th>
                                                        <%=Resources.Language.PlatnosciCode %>
                                                    </th>
                                                    <th>
                                                        <%=Resources.Language.Icon %>
                                                    </th>
                                                    <th>
                                                    </th>
                                                </tr>
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <tr>
                                                <td>
                                                    <%#Eval("PaymentID")%>
                                                </td>
                                                <td>
                                                    <%#Eval("PaymentName")%>
                                                </td>
                                                <td>
                                                    <%# Convert.ToBoolean(Eval("IsActive")) ? Resources.Language.Yes : Resources.Language.No%>
                                                </td>
                                                <td>
                                                    <%#ShopBLL.OrderManager.Instance.GetPaymentGroupString(((ShopModel.PaymentType)Container.DataItem).PaymentGroup)%>
                                                </td>
                                                <td>
                                                    <%#Eval("OnlinePaymentCode")%>
                                                </td>
                                                <td>
                                                    <%#Eval("IconFile")%>
                                                </td>
                                                <td>
                                                    <asp:LinkButton ID="lbtnEdit" runat="server" OnCommand="PaymentsCommand" CommandName="EditP"
                                                        CommandArgument='<%# ((ShopModel.PaymentType)Container.DataItem).PaymentID%>'><%=Resources.Language.Edit %></asp:LinkButton>
                                                    <asp:LinkButton ID="lbtnDelete" runat="server" CommandArgument='<%# ((ShopModel.PaymentType)Container.DataItem).PaymentID%>'
                                                        OnCommand="PaymentsCommand" CommandName="DeleteP"><%=Resources.Language.DeleteUpper %></asp:LinkButton>
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                    <tr>
                                        <td>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="nameTB" runat="server" />
                                        </td>
                                        <td>
                                            <asp:CheckBox ID="activeCB" runat="server" />
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="typeDDL" runat="server" />
                                        </td>
                                        <td>
                                            <asp:TextBox ID="codeTB" runat="server" />
                                        </td>
                                        <td>
                                            <asp:TextBox ID="iconTB" runat="server" />
                                        </td>
                                        <td>
                                            <asp:Button ID="addBTN" runat="server" Text="<%$Resources:Language,Add %>" CommandName="AddP"
                                                OnCommand="PaymentsCommand" />
                                            <asp:Button ID="cancelBTN" runat="server" Text="<%$Resources:Language,Cancel %>"
                                                CommandName="CancelP" OnCommand="PaymentsCommand" />
                                        </td>
                                    </tr>
                                    </table> </span>
                                </div>
                            </fieldset>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </ContentTemplate>
            </axc:TabPanel>
            <axc:TabPanel ID="tpShipment" runat="server" HeaderText="<%$Resources:Language,Shipment %>">
                <ContentTemplate>
                    <asp:UpdatePanel ID="UpdatePanel5" runat="server">
                        <ContentTemplate>
                            <fieldset class="vSeparate">
                                <legend>
                                    <%=Resources.Language.ShipmentMethods %></legend>
                                <div>
                                    <%=Resources.Language.Lang %>:
                                    <asp:DropDownList ID="ddlShipmentLanguage" DataTextField="Name" DataValueField="LanguageID"
                                        runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlShipmentLanguage_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </div>
                                <div class="vSeparate">
                                    <asp:Repeater ID="rptShipmentTypes" runat="server" OnItemCreated="rptShipmentTypes_ItemCreated">
                                        <HeaderTemplate>
                                            <table class="cmsTables">
                                                <tr>
                                                    <th>
                                                        ID
                                                    </th>
                                                    <th>
                                                        <%= Resources.Language.Name %>
                                                    </th>
                                                    <th>
                                                        <%= Resources.Language.DeliveryCost %>
                                                    </th>
                                                    <th>
                                                        <%= Resources.Language.DeliveryCostInUE %>
                                                    </th>
                                                    <th>
                                                        <%= Resources.Language.DeliveryCostOutsideUE %>
                                                    </th>
                                                    <th>
                                                    </th>
                                                    <th>
                                                    </th>
                                                </tr>
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lID" runat="server" Text='<%# Eval("ShipmentID")%>'></asp:Label>
                                                </td>
                                                <td>
                                                    <asp:Label ID="lName" runat="server" Text='<%# Eval("ShipmentName")%>'></asp:Label>
                                                </td>
                                                <td>
                                                    <asp:Label ID="lCountryPrice" runat="server"></asp:Label>
                                                </td>
                                                <td>
                                                    <asp:Label ID="lEUPrice" runat="server"></asp:Label>
                                                </td>
                                                <td>
                                                    <asp:Label ID="lWorldPrice" runat="server"></asp:Label>
                                                </td>
                                                <td>
                                                    <asp:LinkButton ID="lbEdit" runat="server" CommandName="Edit" CommandArgument='<%# Container.ItemIndex %>'
                                                        OnCommand="lbShipmentTypes_Command"><%=Resources.Language.Edit %></asp:LinkButton>
                                                </td>
                                                <td>
                                                    <asp:LinkButton ID="lbDelete" runat="server" CommandName="Delete" CommandArgument='<%# Eval("ShipmentID")%>'
                                                        OnCommand="lbShipmentTypes_Command"><%=Resources.Language.DeleteUpper %></asp:LinkButton>
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblID" runat="server" Text=""></asp:Label>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="tbName" runat="server"></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="tbCountryShipmentPrice" runat="server"></asp:TextBox>
                                            <asp:CheckBox ID="chbCountryShipmentPrice" runat="server" />
                                        </td>
                                        <td>
                                            <asp:TextBox ID="tbEUShipmentPrice" runat="server"></asp:TextBox>
                                            <asp:CheckBox ID="chbEUShipmentPrice" runat="server" />
                                        </td>
                                        <td>
                                            <asp:TextBox ID="tbWorldShipmentPrice" runat="server"></asp:TextBox>
                                            <asp:CheckBox ID="chbWorldShipmentPrice" runat="server" />
                                        </td>
                                        <td>
                                            <asp:Button ID="btnShipmentTypesSave" runat="server" OnCommand="lbShipmentTypes_Command"
                                                CommandName="Add" Text="<%$ Resources:Language,Add %>" />
                                        </td>
                                        <td>
                                            <asp:Button ID="btnShipmentTypesCancel" runat="server" OnCommand="lbShipmentTypes_Command"
                                                CommandName="Cancel" Text="<%$ Resources:Language,Cancel %>" />
                                        </td>
                                    </tr>
                                    </table> </span>
                                </div>
                            </fieldset>
                            <fieldset class="vSeparate">
                                <legend>
                                    <%=Resources.Language.AvailableShipmentOptions %></legend>
                                <asp:Repeater ID="rptShipmentPossibilities" runat="server">
                                    <HeaderTemplate>
                                        <table class="cmsTables">
                                            <tr>
                                                <th>
                                                    ID
                                                </th>
                                                <th>
                                                    <%= Resources.Language.Payment %>
                                                </th>
                                                <th>
                                                    <%= Resources.Language.Shipment %>
                                                </th>
                                            </tr>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <tr>
                                            <td>
                                                <asp:Label ID="lID" runat="server" Text='<%# Eval("PaymentID") %>'></asp:Label>
                                            </td>
                                            <td>
                                                <%# Eval("PaymentName") %>
                                            </td>
                                            <td>
                                                <asp:Repeater ID="rptAvailableShipments" runat="server" DataSource='<%# Eval("ShipmentPosibilities") %>'>
                                                    <ItemTemplate>
                                                        <div>
                                                            <%# Eval("ShipmentName") %>
                                                            (<asp:LinkButton ID="lbDelete" runat="server" OnCommand="lbShipmentPossibilities_Command"
                                                                Text='<%$Resources:Language,DeleteUpper %>' CommandName="Delete" CommandArgument='<%# (Container.Parent.Parent.FindControl("lID") as Label).Text+";"+ Eval("ShipmentID") %>'></asp:LinkButton>)</div>
                                                    </ItemTemplate>
                                                </asp:Repeater>
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
                                <tr>
                                    <td>
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="ddlPaymentTypes" runat="server" DataTextField="PaymentName"
                                            DataValueField="PaymentID">
                                        </asp:DropDownList>
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="ddlShipmentTypes" runat="server" DataTextField="ShipmentName"
                                            DataValueField="ShipmentID">
                                        </asp:DropDownList>
                                        <asp:Button ID="btnShipmentPossibilitiesAdd" runat="server" Text="<%$Resources:Language,Add %>"
                                            OnCommand="lbShipmentPossibilities_Command" CommandName="Add" />
                                    </td>
                                </tr>
                                </table>
                            </fieldset>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </ContentTemplate>
            </axc:TabPanel>
        </axc:TabContainer>
    </div>
</asp:Content>
